The \hyperlink{class_r_t_o_s}{R\-T\-O\-S} uses non-\/preemptive task switching. This means that the C\-P\-U can be switched to another task only when the currenly executing task (directly or indirectly) calls an \hyperlink{class_r_t_o_s}{R\-T\-O\-S} function. Three groups of \hyperlink{class_r_t_o_s}{R\-T\-O\-S} function calls can cause such a task switch\-:


\begin{DoxyEnumerate}
\item functions that cause the current task to become non-\/runnable, like task\-::wait(), and task\-::suspend()
\item functions that make a higher-\/priority task runnable, like flag\-::set(), and task\-::resume()
\item the function task\-::release(), which only purpose is to give up the C\-P\-U to a higher priority task.
\end{DoxyEnumerate}

A task can be made runnable either by an excplicit action from another task, like an event\-\_\-flag\-::set() or task\-::resume() call, or implicitly by the expiration of a timer. But even for the latter case (timer expiration) the switching to another task can occur only when an \hyperlink{class_r_t_o_s}{R\-T\-O\-S} function is called.

The diagram below shows the state-\/event diagram for a task. The transitions from ready to running and back are governed by the \hyperlink{class_r_t_o_s}{R\-T\-O\-S} always selecting the highest-\/priority runnable task. The events that cause the transitions between runnable and blocked and vice versa, and between blocked-\/and-\/suspended and suspended are the same, they are shown in the enlarged box. A task can only get blocked by doing something (wait, read a mailbox, etc), hence there is no transition from suspended to blocked-\/and-\/suspended.

T\-B\-W diagram 